how to use enums and generics